//
//  OrangeView.m
//  03-UIView的拖拽
//
//  Created by J on 16/2/19.
//  Copyright © 2016年 J. All rights reserved.
//

#import "OrangeView.h"

@implementation OrangeView


- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{
    
    NSLog(@"%zd",touches.count);

}
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event{
//    NSLog(@"%@",touches);
        UITouch* touch = touches.anyObject;
   CGPoint curP = [touch locationInView:self];
    CGPoint preP = [touch previousLocationInView:self];

    CGFloat offsetX = curP.x - preP.x;
    CGFloat offsetY = curP.y - preP.y;

    self.transform = CGAffineTransformTranslate(self.transform, offsetX, offsetY);

    
}
- (void)touchesEnded:(NSSet<UITouch *> *)touches withEvent:(nullable UIEvent *)event{
//    NSLog(@"%s",__func__);
}
@end
